<table class="table table-border table-bordered table-hover table-bg">
	<thead>
		<tr class="text-c">
			<th>编号</th>
			<th>用户名称</th>
			<th>房间号</th>
			<th>房卡号</th>
			<th>办理时间</th>
			<th>房卡类型</th>
			<th>房间锁号</th>
			<th>房租开始时间</th>
			<th>房租结束时间</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<?php if($list){ foreach($list as $k=>$ls){ ?>
		<tr class="text-c">
			<td><?php echo ($page-1)*C('PAGE_SIZE')+($k+1); ?></td>
			<td>{$ls['member_nick']}</td>
			<td>{$ls['room_number']}</td>
			<td>{$ls['card']}</td>
			<td><?php echo date('Y-m-d H:i:s', $ls['createtime']);?></td>
			<td>{$ls['card_type'] == 1 ? '临时卡' : '制宾卡'}</td>
			<td>{$ls['lock_id']}</td>
			<td><?php echo date('Y-m-d H:i:s', $ls['checkin_time']); ?></td>
			<td><?php echo date('Y-m-d H:i:s', $ls['leav_time']); ?></td>
			<td id="log_{$ls['id']}">
				<?php if($ls['is_back']){ ?>
					已退卡
				<?php }else{ ?>
					<?php if($ls['card_type'] == 1){ ?>
					<a href="javascript:;" class="btn btn-danger radius goback" logid="{$ls['id']}">退卡</a> 
					<?php } ?>
				<?php } ?>
			</td>
		</tr>
		<?php } }else{ ?>
		<tr class="text-c">
			<td colspan="14">暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<!--page-->
<include file="Common/page" />
<script>
	$(document).ready(function(){
		$(".goback").on('click', function(){
			var id = $(this).attr('logid');
			$.post('roomcard.html', {id: id}, function(data){
				if(data/1 == 1){
					$("#log_"+ id).html('已退卡');
				}else{
					layer.msg(data, {icon: 2, time: 2000});
				}
			});
		})
	});
</script>